//
//  PMJoint.h
//  PezMonkey
//
//  Created by Spence DiNicolantonio on 10/30/09.
//  Copyright 2009 Necrosoft. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "PMCore.h"

@class PMBody;


#pragma mark -
#pragma mark Constants / Enums / Types

// Joint Types
typedef enum _PMJointType {
	PMJointTypePin,
	PMJointTypePivot,
	PMJointTypeSlide,
	PMJointTypeGroove,
	PMJointTypeCustom,
} PMJointType;

// Joint Body Keys
typedef enum _PMJointBodyKey {
	PMJointBodyKeyA,
	PMJointBodyKeyB,
} PMJointBodyKey;

// Anchor Type
typedef PMVect PMAnchor;
static inline PMAnchor PMAnchorMake(PMFloat x, PMFloat y) {
	return PMVectMake(x, y);
}

#pragma mark -


@interface PMJoint : NSObject {
@protected
	// Chipmunk joint reference
	cpJoint *joint;
	
@private
	// Rigid bodys to connect
	PMBody *bodyA;
	PMBody *bodyB;
}

@property (nonatomic, retain) PMBody *bodyA;
@property (nonatomic, retain) PMBody *bodyB;


#pragma mark -
#pragma mark Getters
- (cpJoint *)cpJoint;
- (PMJointType)type;
- (PMBody *)bodyForKey:(PMJointBodyKey)bodyKey;

@end
